Nevron Open Vision Documentation
Framework / Layouts / Stack Layout
In This Topic
    Stack Layout
    In This Topic

    The stack layout is represented by the NStackLayout class. The stack layout places the boxes one after the other, thus forming a single stack lane (pile).

     Direction

    The stack layout is a directed box layout, which stacks the cells in the direction specified by the Direction property, which takes values from the ENHVDirection enumeration:

    ENHVDirection Description
    TopToBottom The layout is directed vertically, starting from the top and expanding downwards.
    BottomToTop The layout is directed vertically, starting from the bottom and expanding upwards.
    LeftToRight The layout is directed horizontally, starting from the left and expanding to the right.
    RightToLeft The layout is directed horizontally, starting from the right and expanding to the left.

    The stack layout is constrained by the size of the layout area in the current direction (e.g. for a top-to-bottom direction the layout is constrained by height).

     Spacing
    The stack layout tries to place the items one after the other at their desired size, spaced by the values specified by the HorizontalSpacing or VerticalSpacing properties. For a vertically oriented direction the layout uses only the vertical spacing, while for a horizontally oriented direction the layout uses only the horizontal spacing.
     Filling and Fitting

    In respect to the constraining dimension (i.e. height for a vertically oriented stack, width for a horizontally oriented stack), the stacking can either occupy more or less space than available.

    In case the ordinary stacking occupies less space you can instruct the stack layout to inflate the cells in order to fill the available space. This is specified by the FillMode property, which takes a value from the ENStackFillMode enumeration:

    ENStackFillMode Description
    None The stack does not attempt to fill the available area. This is the default value.
    Equal The stack increases the items size with equal amounts to fill the available area.
    Proportional The stack increases the items size with proportional amounts to fill the available area.
    First The stack increases the items size in forward order until the stack fills the available area.
    Last The stack increases the items size in reverse order until the stack fills the available area.
    Justify The stack increases the spacing between the items to fill the available area.

    In the other case when ordinary stacking occupies more space you can instruct the stack layout to deflate the cells in order to fit the available space. This is specified by the FitMode property, which takes a value from the ENStackFitMode enumeration:

    ENStackFitMode Description
    None The stack does not attempt to fit the available area. This is the default value.
    Equal The stack decreases the items size with equal to fit the available area.
    Proportional The stack decreases the items size with proportional amounts to fit the available area.
    First The stack decreases the items size in forward order until the stack fits the available area.
    Last The stack decreases the items size in reverse order until the stack fits the available area.

    Both the filling and fitting take into account the per-cell specified MinSize and MaxSize constrains (only in the respective direction), which means that both filling and fitting may not always ensure that the available space is fully occupied, because this may break a MinSize or MaxSize constraint.

    See Also